<template>
	<view class="claim-order-detail" v-if="detail.id">
		<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
			:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="icon-left" title="养殖详情">
		</uni-nav-bar>
		<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
		<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png"></image>

		<view class="order-item fill-base mg-big pd-lg radius-16 box-shadow" :class="[{'mt-md':index!=0}]">
			<view class="flex-center" :class="[{'mt-md':aindex!=0}]" v-for="(aitem,aindex) in detail.order_goods"
				:key="aindex">
				<image mode="aspectFill" lazy-load class="avatar radius-16" :src="aitem.goods_cover"></image>
				<view class="flex-1 ml-lg">
					<view class="f-paragraph c-title text-bold ellipsis" style="max-width: 498rpx;">
						{{aitem.goods_name}}
					</view>
					<view class="flex-between f-desc c-caption mt-md">
						<view class="f-paragraph c-warning"> ¥{{aitem.goods_price}} </view>
						<view>x{{aitem.goods_num}}</view>
					</view>
				</view>
			</view>
		</view>

		<view class="fill-base mg-md pd-lg radius-24" v-if="detail.text">
			<view class="f-paragraph c-title">
				<view class="c-desc">订单备注</view>
				<view class="mt-sm">
					<text decode="emsp" style="word-break:break-all;">{{detail.text}}</text>
				</view>
			</view>
		</view>

		<view class="fill-base mg-md pd-lg radius-24">
			<view class="flex-between f-paragraph c-title">
				<view class="c-desc">订单编号</view>
				<view class="flex-warp">
					<view class="max-400 ellipsis">{{detail.order_code}}</view>
					<view @tap="$util.goUrl( {url:`${detail.order_code}`,openType:'copy'})"
						class="copy-btn flex-center fill-body" :style="{color:primaryColor}">复制</view>
				</view>
			</view>
			<view class="flex-between f-paragraph c-title mt-lg">
				<view class="c-desc">付款单号</view>
				<view class="flex-warp">
					<view class="max-400 ellipsis">{{detail.transaction_id}}</view>
					<view @tap="$util.goUrl( {url:`${detail.transaction_id}`,openType:'copy'})"
						class="copy-btn flex-center fill-body" :style="{color:primaryColor}">复制</view>
				</view>
			</view>
			<view class="flex-between f-paragraph c-title mt-lg">
				<view class="c-desc">下单时间</view>
				<view>{{detail.create_time}}</view>
			</view>
			<view class="flex-between f-paragraph c-title mt-lg" v-if="detail.pay_time">
				<view class="c-desc">支付时间</view>
				<view>{{detail.pay_time}}</view>
			</view>
			<view class="flex-between f-paragraph c-title mt-lg">
				<view class="c-desc">实付金额</view>
				<view class="c-warning">¥{{detail.pay_price}}</view>
			</view>
			<view class="flex-between f-paragraph c-title mt-lg">
				<view class="c-desc">支付方式</view>
				<view>{{payType[detail.pay_model]}}</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from "vuex"
	export default {
		components: {},
		data() {
			return {
				scrollTop: 0,
				options: {},
				detail: {},
				payType: {
					1: '微信支付',
					2: '余额支付',
					3: '支付宝支付'
				},
			}
		},
		onLoad(options) {
			this.$util.showLoading()
			this.options = options
			this.initIndex()
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop
		},
		computed: mapState({
			primaryColor: state => state.config.configInfo.primaryColor,
			subColor: state => state.config.configInfo.subColor,
			configInfo: state => state.config.configInfo,
			userInfo: state => state.user.userInfo
		}),
		methods: {
			...mapActions(['']),
			async initIndex() {
				let {
					id
				} = this.options
				let data = await this.$api.claim.breedOrderInfo({
					id
				})
				this.detail = data
				this.$util.hideAll()
			},
			initRefresh() {
				this.initIndex()
			}
		}
	}
</script>


<style lang="scss">
	.claim-order-detail {

		.order-video-info {
			width: 750rpx;
			height: 380rpx;
			margin-top: 26rpx;

			.video-img {
				width: 750rpx;
				height: 380rpx;
			}

			.video-bg {
				top: 0;
				left: 0;
				width: 750rpx;
				height: 380rpx;
				background: rgba(0, 0, 0, 0.5);

				.iconfont {
					font-size: 70rpx;
				}
			}
		}

		.order-count-info {
			.count-item {
				width: 33.33%;
			}
		}

		.order-seed-item {
			.seed-img {
				width: 80rpx;
				height: 80rpx;
				box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
			}
		}

		.send-btn {
			width: 180rpx;
			height: 56rpx;
		}
	}
</style>
